<!doctype html>
<html lang="zh-cn">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>边框线条动画</title>
  <!--  <link rel="stylesheet" href="./styles/index.css" />-->
</head>
<style>
  div {
    position: relative;
    margin: auto;
    width: 160px;
    line-height: 160px;
    text-align: center;
    font-size: 24px;
  }
  div::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid gold;
    transition: all 0.5s;
    animation: clippath 2s infinite linear;
  }

  @keyframes clippath {
    0%, 100% {
      clip-path: inset(0 0 0 95%);
    }
    25% {
      clip-path: inset(95% 0 0 0);
    }
    50% {
      clip-path: inset(0 95% 0 0);
    }
    75% {
      clip-path: inset(0 0 95% 0);
    }
  }
  .bg::before {
    background: rgba(255, 215, 0, 0.5);
  }

</style>
<body>
<div>Hello</div>
<div class="bg">示意图</div>
</body>
</html>
